<?php
require DOCMENT_ROOT.'/Framework/controller.class.php';
class newController extends controller{
    public function __construct(){
        parent::header();
        parent::smartyAction("Index");
    }
    public function add(){
         $this->smarty->display("newadd.html"); //定义合并文件
    }
    //添加
     public function newadd(){
        $title=$_GET["title"];
        $content=$_GET["content"];
        //调取数据
       require DOCMENT_ROOT."/Application/Index/model/newModel.class.php";
       $newModel=new newModel();
        $newadd=$newModel->newadd($title,$content);
        echo $newadd;
    }
    public function newContent(){
        $id=$_GET["id"];
         //调取数据
       require DOCMENT_ROOT."/Application/Index/model/newModel.class.php";
       $newModel=new newModel();
    
      $row = $newModel->newContent("id = $id");
//      var_dump($row);
      $this->smarty->assign("title",$row[0]["title"]);
       $this->smarty->assign("content",$row[0]["content"]);
       $this->smarty->assign("click",$row[0]["click"]);
       $this->smarty->assign("add_time",$row[0]["add_time"]);
       $this->smarty->display("newcontent.html");  //指定模板文件
    }
   
    
}